<%@page import="java.util.ArrayList"%>
<%@page import="com.mconnect.msurvey.model.SurveyPlan"%>
<%@page import="java.util.List"%>
<%@page import="com.mconnect.msurvey.controller.PlanManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
      <%@ taglib prefix="s" uri="/struts-tags"%>
<%// w celu poprawnie dzialajacej sesji:
response.setHeader("Cache-Control","no-store"); 
response.setHeader("Pragma","no-cache"); 
response.setDateHeader ("Expires", 0); 
%>     
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
	  <title>Panel Admina</title>
	<link rel="stylesheet" type="text/css" href="resources/css/search_grid_style.css" />
	<link rel="stylesheet" href="resources/css/ap.css">
  	<link rel="stylesheet" href="js/jQuery/themes/base/jquery.ui.all.css">
  	<link rel="stylesheet" href="js/jQuery/demos.css">
  	<link rel="stylesheet" href="resources/css/detail_style.css">
	<script src="js/jQuery/jquery-1.8.2.js"></script>
	<script src="js/jQuery/ui/jquery.ui.core.js"></script>
	
	<style type="text/css">
		input{
			width: 130px;
		}
		td#label{
			width: 150px;
			margin-left: 10px;
			height: 30px;
		}
		td#cont{
			width: 150px;
		}
		

	</style>

<script type="text/javascript">
		$(function() {
		$('.ui-tabs-search .search-adv-button').click(function(){$('#search-adv-form').toggle();});
		$('#choosePlan').click(function(){
				var id_plan = $( "#r_id_plan" ).val();
				var firstname = $( "#r_firstname" ).val();
				var lastname = $( "#r_lastname" ).val();
				var mail = $( "#r_mail" ).val();
				var status = $( "#r_status" ).val();
				var phone = $( "#r_phone" ).val();
				var type = $( "#r_type" ).val();
				$.post(
						'searching/showRecommendContent.jsp',
						{
							id_plan: id_plan, firstname: firstname, lastname: lastname, mail : mail,
							status: status, phone : phone, type: type
						},
						function (content) {
							$('#content').html(content);
							return false;
						}
					);
			});
		});
</script>
	
  </head>
<body>
	<center>
		
		<% PlanManager pM = new PlanManager();
			List<SurveyPlan> planList = new ArrayList<SurveyPlan>();
			planList = pM.getPlanList();
		%>
			<center>
				
				<div id="content1" style=" margin-top: 30px; margin-bottom: 30px;  font-size: 12px;">

			<div id="page" class="ui-tabs ui-widget" style="width: 850px;">
				<ul class="ui-tabs-nav ui-tabs-search">
					<li style="border: 0; width: 200px; margin-left: 50px; text-align: center;"><h3>Polecone osoby</h3></li>
					<li class="search-bottom">
						<span class="fll hint note request-time" style="margin-top: 9px;">Kampania</span>
						<a href="#" class="search-adv-button fll"><span class="ui-icon ui-icon-carat-1-s"></span></a>
						<select id="r_id_plan" name="id_plan"  style="float:left; margin-top: 7px; width:200px;">
						<% for(SurveyPlan plan : planList){ %> 
									<option value="<%=plan.getId_plan() %>"><%= plan.getPlanName() %></option>
								<%} %>	
						</select>
						<a href="#" id="choosePlan" class="search-button fll"><span class="ui-icon ui-icon-search"></span></a>
					</li>
				</ul>
				<div class="clear"></div>
				<div id="search-adv-form" class="form search-form" style="display:none">
					<div class="wide">

						<table style="width: 810px;">
							<tr>
								<td style="width: 270px;">
									<label class="note" style="margin-top:3px;">Imie</label> 
									<input type="text"  id="r_firstname">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Nazwisko</label>
									<input type="text"  id="r_lastname">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Telefon</label>
									<input type="text"  id="r_phone">
								</td>
							</tr>
							<tr>
								<td>
									<label class="note" style="margin-top:3px;">Mail</label>
									<input type="text" id="r_mail">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Status</label>
									<select id="r_status">
										<option value="NIE">Nie zatwierdzony</option>
										<option value="TAK">Zatwierdzony</option>
										<option value="all">Wszystkie</option>
										
									</select>
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Typ polecenia</label>
									<select style="width: 135px;" id="r_type">
										<option value="all">Wszystkie</option>
										<option value="responder">Ankieter</option>
										<option value="HR">Dział HR</option>
									</select>
								</td>
							</tr>
						</table>
					</div>
				</div>
				<div class="clear"></div>
				<div class="search-label"></div>
				<div class="clear"></div>
				<div id="paging_container" class="container">
				<div id="reload" class="ui-overlay" style="display: none;"><div class="ui-widget-overlay"></div></div>
					
					<div class="clear"> </div>
					<div class="info_text hint note fll"> </div>
					<div class="page_navigation frr"> </div>
				</div>
				<div class="clear"></div>
			</div><!-- page -->
				
				</div>
				
				<div id="content" style="width: 900px;">
				
				</div>
		</center>
		
	</center>
</body>
</html>